package com.jack.database_exp.controller;
import com.alibaba.fastjson.JSON;
import com.jack.database_exp.bean.Goods;
import com.jack.database_exp.mapper.GoodsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;

@Controller
public class GoodsController{
    @Autowired
    GoodsMapper goodsMapper;
    @RequestMapping(value = "/goods",method={RequestMethod.POST})
    @ResponseBody
    public List<Goods> getGoods(){
        List<Goods> lists = goodsMapper.queryGoods();
        System.out.println(lists);
        System.out.println(JSON.toJSONString(lists));
        return lists;
    }
}